<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
	href="../jquery/redmond/jquery-ui-1.9.0.custom.min.css" />
<link rel="stylesheet" type="text/css" href="../css/default.css" />
<link rel="stylesheet" type="text/css" href="../css/css.css" />
<script type="text/javascript" src="../jquery/jquery-1.8.2.min.js"></script>
<script type="text/javascript"
	src="../jquery/jquery-ui-1.9.0.custom.min.js"></script>
<script type="text/javascript" src="../jquery/jquery-extends.js"></script>
<script type="text/javascript"
	src="../jquery/jquery.printElement.min.js"></script>
<script type="text/javascript">
	//C#回调交互

	//手动上传日志
	function doManualUploadLog() {
		var res = window.external.onManualUploadLog();
	}

	//箱号扫描到,则请求箱详细信息，并添加到页面
	//param 形如"{"boxids":[{"boxid":"551agw12233","uids":["123","AJKSF","AJ1sdGKSF","AJKSF","AawegJKSF","AJ23yhKSF","AJKserhSF"]}],"uids":["AJKSF","AJ23yhKSF","123"]}"
	//boxids代表所有箱关联的boxid和uid，uid数组第一个为自己的uid，接下来是包含瓶的uid，而uids代表所有扫描到的uid，前台要判断是否匹配做相应处理
	function onNewBoxId(param) {
		var paramJson = eval("(" + param + ")");
		//$.alert(param, "提示");
		//把所有的处理事件放到最后的添加html代码中去,只有当扫描到至少一箱有效箱标签才能列出来比对,比对的为第一箱
		if (paramJson.boxids.length > 0) {
			onSearchBoxId(paramJson.boxids[0].boxid, '2', true, paramJson);
		}
	}

	//1表示超过了7张标签扫描到  0表示1张都没有扫描到 
	function onErrorBoxId(str, params) {
		var errMsg;
		if (str == "0") {
			errMsg = "没有扫到标签。";
		} else if (str == "1") {
			errMsg = "扫描到超过7张标签。 ";
		}
		var date = new Date();
		var nowtime = date.toLocaleTimeString();

		var prependStr = "<p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span>";
		prependStr += "<span style='display: inline-block; width: 400px;'>"
				+ errMsg + "</span>" + nowtime + "&nbsp;&nbsp;&nbsp;"
				+ "<a href='' class='T" + date.getTime() + "'>删除</a></p>";

		$('#somethingerror').prepend(prependStr);

		$('#somethingerrordiv').css('display', 'block');

		$('#somethingerror a.T' + date.getTime()).click(function(event) {
			event.preventDefault();
			$(this).parent().remove();
			if ($('#somethingerror a').length == 0) {
				$('#somethingerrordiv').css('display', 'none');
			}
		})
	}

	var previousBoxId = 0;

	function onErrorUids(params) {
		//var paramJson = eval("(" + params + ")");

		//var uids = paramJson.uids;
		var errMsg = "";
		if (previousBoxId == 0) {
			errMsg += "扫描到未入库标签。";
		} else {
			errMsg += "扫描到未入库标签，在箱号" + previousBoxId + "之后。";
		}
		/*
		for(var i=0;i<uids.length;i++)
		{
			errMsg += uids[i]+" ";			
		}
		 */

		var date = new Date();
		var nowtime = date.toLocaleTimeString();

		var prependStr = "<p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span>";
		prependStr += "<span style='display: inline-block; width: 400px;'>"
				+ errMsg + "</span>" + nowtime + "&nbsp;&nbsp;&nbsp;"
				+ "<a href='' class='T" + date.getTime() + "'>删除</a></p>";

		$('#somethingerror').prepend(prependStr);

		$('#somethingerrordiv').css('display', 'block');

		$('#somethingerror a.T' + date.getTime()).click(function(event) {
			event.preventDefault();
			$(this).parent().remove();
			if ($('#somethingerror a').length == 0) {
				$('#somethingerrordiv').css('display', 'none');
			}
		})

	}

	//这里可以显示C#内部的重要异常
	function onCSharpError(str) {
	}

	$(function() {
		//初始化页面
		initlizeComponents();
		//初始化控件事件
		initlizeComponentEvents();
	});

	//初始化页面
	function initlizeComponents() {
		//初始化tab
		if ($.browser.msie) {
			$("#tabs").tabs({
				activate : function(event, ui) {
					var oselector = ui.oldPanel.selector + '';
					var nselector = ui.newPanel.selector + '';
					var oid = oselector.substring(oselector.length - 1);
					var nid = nselector.substring(nselector.length - 1);
					$("#tabs-" + oid).hide();
					$("#tabs-" + nid).show();
				}
			});
		} else {
			$("#tabs").tabs();
		}

		$("#tabs-2").hide();

		//初始化dialog
		$("#destoryBoxDiv")
				.dialog(
						{
							autoOpen : false,
							height : 300,
							width : 370,
							modal : true,
							buttons : {
								"废除该箱" : function() {
									var username = $('#username')[0].value;
									var password = $('#password')[0].value;
									var boxid = $('#boxid')[0].value;
									$
											.ajax({
												url : "../../storage/retrievebox.htm",
												type : "POST",
												data : {
													username : username,
													password : password,
													boxid : boxid
												},
												cache : false,
												dataType : "json",
												success : function(data,
														textStatus, jqXHR) {
													if (data != null
															&& data != "") {
														if (data.result == "1") {
															//并且显示成功信息
															$('#errMsg3')
																	.html(
																			"成功废除箱"
																					+ boxid
																					+ "!");
															//删除该行数据
															$(
																	'#searchResults1Red')
																	.find(
																			'tr[class*="myOutBoxId'
																					+ boxid
																					+ '"]')
																	.remove();
															$("#destoryBoxDiv")
																	.dialog(
																			"close");
														} else {
															$('#errMsg3').html(
																	data.err);
														}
													}
												}
											});
								},
								"取消" : function() {
									$(this).dialog("close");
								}
							},
							close : function() {

							}
						});

		//出库确认
		$("#confirmoutware").dialog({
			autoOpen : false,
			height : 800,
			width : 1000,
			modal : true,
			close : function() {
			}
		});

		//错误列表
		$('#somethingerror').text('');

		//初始化表
		var $searchResults1 = $('#searchResults1Black');
		$('#searchResults1Black').html("");
		$('#searchResults1Red').html("");

		$searchResults2 = $('#searchResults2');
		$('#searchResults2').html("");

		//初始化tabs
		$("#tabs").tabs();

		//如果没有撤箱权限隐藏
		if (!window.parent.isGranted(6)) {
			$('#outCancelBoxMode').hide();
		}
		if (!window.parent.isGranted(2)) {
			$('#outBoxMode').hide();
			$('#tabs-1').hide();
			$('#tabs-2').show();
		}
		//初始化销售地列表 
		initlizeSellArea();
	}
	function onChangeSellArea() {
		$('#textSellArea').text($("#sellArea").find("option:selected").text()

		);
	}
	//初始化销售地信息
	function initlizeSellArea() {
		var $sellArea = $('#sellArea');
		$('#sellArea option').remove();
		$
				.ajax({
					url : "../../storage/selldest.htm",
					type : "POST",
					cache : false,
					data : "",
					dataType : "json",
					success : function(data, textStatus, jqXHR) {
						if (data != null && data != "") {
							if (data.result == "1") {
								//遍历添加销售地列表
								for ( var i = 0; i < data.ids.length; i++) {
									$sellArea
											.append('\r\n<option value="'+data.ids[i].id+'">'
													+ data.ids[i].n
													+ '</option>');
								}

								//textSellArea
								$('#textSellArea').text(
										$("#sellArea").find("option:selected")
												.text()

								);
							} else {
								$('#errMsg1').html(data.err);
							}
						} else {
							$('#errMsg1').html("请求网络异常");
						}
					}
				});
	}

	//初始化事件响应
	function initlizeComponentEvents() {
		//RFID扫描
		$('#rfidCheck1').click(function(event) {
			var targettext = $(event.target).text();
			if (targettext == "出库扫描") {
				//先检查读卡器是否已连接
				if (window.external.onRequestReaderState() == true) {
					$(event.target).text("扫描停止");
					window.parent.isScanned = true;
					window.external.onStartScan(true);
				} else {
					$.alert("当前读卡器连接异常", "提示");
				}
			} else {
				$(event.target).text("出库扫描");
				window.parent.isScanned = false;
				window.external.onStartScan(false);
			}
		});

		//全选/清除
		$('#selectAll1').click(
				function(event, isManual) {
					if (isManual != true) {
						$('#selectAll11').trigger('click', true);
						if (event.target.checked) {
							$('#searchResults1Black input[type="checkbox"]')
									.attr("checked", 1);
							$('#searchResults1Red input[type="checkbox"]')
									.attr("checked", 1);
						} else {
							$('#searchResults1Black input[type="checkbox"]')
									.removeAttr("checked");
							$('#searchResults1Red input[type="checkbox"]')
									.removeAttr("checked");
						}
					}
				});
		$('#selectAll11').click(
				function(event, isManual) {
					if (isManual != true) {
						$('#selectAll1').trigger('click', true);
						if (event.target.checked) {
							$('#searchResults1Black input[type="checkbox"]')
									.attr("checked", 1);
							$('#searchResults1Red input[type="checkbox"]')
									.attr("checked", 1);
						} else {
							$('#searchResults1Black input[type="checkbox"]')
									.removeAttr("checked");
							$('#searchResults1Red input[type="checkbox"]')
									.removeAttr("checked");
						}
					}
				});

		$('#selectAll2').click(
				function(event, isManual) {
					if (isManual != true) {
						if (event.target.checked) {
							$('#searchResults2 input[type="checkbox"]').attr(
									"checked", 1);
						} else {
							$('#searchResults2 input[type="checkbox"]')
									.removeAttr("checked");
						}
						$('#selectAll22').trigger('click', true);
					}
				});

		$('#selectAll22').click(
				function(event, isManual) {
					if (isManual != true) {
						$('#selectAll2').trigger('click', true);
						if (event.target.checked) {
							$('#searchResults2 input[type="checkbox"]').attr(
									"checked", 1);
						} else {
							$('#searchResults2 input[type="checkbox"]')
									.removeAttr("checked");
						}
					}
				});

		//清除结果集1
		$('#clearResult1').click(function(event) {
			$('#searchResults1Black tr').remove();
			$('#searchResults1Red tr').remove();
			$('#errMsg1').html("");
			$('#tabs-1 input[type=checkbox]').removeAttr('checked');

			$('#somethingerror').html("");
			$('#somethingerrordiv').css('display', 'none');

			previousBoxId = 0;
		});

		//清除结果集2
		$('#clearResult2').click(function(event) {
			$('#searchResults2 tr').remove();
			$('#errMsg2').html("");
			$('#tabs-2 input[type=checkbox]').removeAttr('checked');
		});

		//过滤添加出库箱事件
		$('#searchBox1').click(function(event) {
			//根据箱号搜索箱详情
			onSearchBoxId(boxId1.value, '2', false);
		});

		//过滤撤销出库箱事件
		$('#searchBox2').click(function(event) {
			//根据箱号搜索箱详情
			onSearchBoxId(boxId2.value, '3', false);
		});

		//搜索添加回车事件
		$("#boxId1").keydown(function(e) {
			if (e.which == 13) {
				//根据箱号搜索箱详情
				onSearchBoxId(boxId1.value, '2', false);
			}
		});

		$("#boxId2").keydown(function(e) {
			if (e.which == 13) {
				//根据箱号搜索箱详情
				onSearchBoxId(boxId2.value, '3', false);
			}
		});

		//注册全部撤销出库事件函数
		$('#cancelAllOutBox').bind(
				'click',
				function(event) {
					var boxes = "";
					var boxesNoQuote = "";
					//选中对应的checkBox,拼接所有的出库BoxId

					var isBeign = true;
					$('#searchResults2 tr input[type="checkbox"]').each(
							function(index) {
								var isChecked = $(this).attr('checked');
								var boxId = $(this).parent().parent().find(
										'.myBoxText').text();
								var disBoxId = $(this).parent().next().text();
								if (isChecked) {
									if (isBeign) {
										boxes = boxId;
									} else {
										boxes = boxes + ',' + "" + boxId + "";
									}
									if (isBeign) {
										boxesNoQuote = "<br/>" + disBoxId;
									} else if (index % 2 == 0) {
										boxesNoQuote = boxesNoQuote + ",<br/>"
												+ disBoxId;
									} else {
										boxesNoQuote = boxesNoQuote + ", "
												+ disBoxId;
									}
									isBeign = false;
								}
							});

					boxesNoQuote += "<br/>";

					//没有选择则取消
					if (boxes == "") {
						return;
					}

					//发送的json数据
					var data = "json={'ids':[" + boxes + "],'aid':'"
							+ $('#sellArea')[0].value + "','t'='2'}";
					//撤销出库
					outWareHouse(data, boxesNoQuote, boxes, '3');
				});

		//注册全部出库事件函数
		$('#allOutBox')
				.bind(
						'click',
						function(event) {

							var boxes = "";
							var boxesNoQuote = "";
							var isBeign = true;

							//组织出库统计数据
							var statistics = new Array();

							//选中对应的checkBox,拼接所有的出库BoxId
							$('#searchResults1Black tr input[type="checkbox"]')
									.each(
											function(index) {
												var isChecked = $(this).attr(
														'checked');

												if (isChecked) {

													var boxId = $(this)
															.parent().parent()
															.find('.myBoxText')
															.text();
													var disBoxId = $(this)
															.parent().parent()
															.find('.myBoxDis')
															.text();
													var name = $(this).parent()
															.parent()
															.find('.myBoxName')
															.contents()[0].nodeValue;
													var nameCode = $(this)
															.parent()
															.parent()
															.find(
																	'.myProductCode')
															.text();

													findIndex = arrayContainsNameCode(
															statistics,
															nameCode);

													if (findIndex != -1) {
														maxIndex = statistics[findIndex].boxids.length;
														statistics[findIndex].boxids[maxIndex] = disBoxId;
														statistics[findIndex].count++;
													} else {
														var item = {};
														item.nameCode = nameCode; //产品码
														item.name = name; //产品名
														item.count = 1; //箱数
														item.boxids = new Array();
														item.boxids[0] = disBoxId;
														statistics[statistics.length] = item;
													}

													if (isBeign) {
														boxes = boxId;
													} else {
														boxes = boxes + ','
																+ "" + boxId
																+ "";
													}
													if (isBeign) {
														boxesNoQuote = "<br/>"
																+ disBoxId;
													} else if (index % 2 == 0) {
														boxesNoQuote = boxesNoQuote
																+ ",<br/>"
																+ disBoxId;
													} else {
														boxesNoQuote = boxesNoQuote
																+ ", "
																+ disBoxId;
													}
													isBeign = false;
												}
											});
							$('#searchResults1Red tr input[type="checkbox"]')
									.each(
											function(index) {
												var isChecked = $(this).attr(
														'checked');

												if (isChecked) {

													var boxId = $(this)
															.parent().parent()
															.find('.myBoxText')
															.text();
													var disBoxId = $(this)
															.parent().parent()
															.find('.myBoxDis')
															.text();
													var name = $(this).parent()
															.parent()
															.find('.myBoxName')
															.contents()[0].nodeValue;
													var nameCode = $(this)
															.parent()
															.parent()
															.find(
																	'.myProductCode')
															.text();

													findIndex = arrayContainsNameCode(
															statistics,
															nameCode);

													if (findIndex != -1) {
														maxIndex = statistics[findIndex].boxids.length;
														statistics[findIndex].boxids[maxIndex] = disBoxId;
														statistics[findIndex].count++;
													} else {
														var item = new Array();
														item.nameCode = nameCode; //产品码
														item.name = name; //产品名
														item.count = 1; //箱数
														item.boxids = new Array();
														item.boxids[0] = disBoxId;
														statistics[statistics.length] = item;
													}

													if (isBeign) {
														boxes = boxId;
													} else {
														boxes = boxes + ','
																+ "" + boxId
																+ "";
													}
													if (isBeign) {
														boxesNoQuote = "<br/>"
																+ disBoxId;
													} else if (index % 2 == 0) {
														boxesNoQuote = boxesNoQuote
																+ ",<br/>"
																+ disBoxId;
													} else {
														boxesNoQuote = boxesNoQuote
																+ ", "
																+ disBoxId;
													}
													isBeign = false;
												}
											});

							boxesNoQuote += "<br/>";

							//没有选择则取消
							if (boxes == "") {
								return;
							}

							//出库确认
							onConfirmOutWareHouse(boxesNoQuote, boxes, '2',
									statistics);
						});
	}

	function arrayContainsNameCode(array, nameCode) {
		for ( var index = 0; index < array.length; index++) {
			if (array[index].nameCode == nameCode) {
				return index;
			}
		}
		return -1;
	}
	//确认出库事件 statistics.nameCode 产品码 statistics.name 产品名 statistics.count 箱数 statistics.boxids 箱号
	function onConfirmOutWareHouse(boxesNoQuote, boxes, type, statistics) {

		var staticsBody = "";

		for ( var pdindex = 0; pdindex < statistics.length; pdindex++) {

			var boxidBody = "箱号: <br/>";

			staticsBody += "<tr class = 'Pd"+statistics[pdindex].nameCode+"' style='border: solid #2575B4;'>";
			staticsBody += "<td>" + statistics[pdindex].nameCode + "</td>";
			staticsBody += "<td>" + statistics[pdindex].name + "</td>";
			staticsBody += "<td>" + statistics[pdindex].count + "</td>";

			ids = statistics[pdindex].boxids;
			for ( var idIndex = 0; idIndex < ids.length - 1; idIndex++) {
				boxidBody += ids[idIndex] + " , ";
			}
			boxidBody += ids[idIndex];
			staticsBody += "</tr>";

			staticsBody += "<tr class = 'ids' ><td colspan=3 style='border-bottom: solid #2575B4;'>"
					+ boxidBody + "</td></tr>";
		}

		$("#statics").html(staticsBody);

		//隐藏显示事件
		var $idsTr = $("#statics").find("tr[class*=Pd]");
		$idsTr.each(function() {
			$(this).click(function() {
				$(this).next().toggle();
			}), $(this).hover(function() {
				$(this).css("cursor", "pointer");
			})
		});
		$('#statics').find('.ids').each(function() {
			$(this).click(function() {
				$(this).toggle();
			}), $(this).hover(function() {
				$(this).css("cursor", "pointer");
			})
		});

		//行为
		$("#confirmoutware")
				.dialog(
						"option",
						{
							buttons : {
								"确认出库" : function() {
									//先出库错误列表的箱号
									var data;
									var boxes;
									var isBegin;

									do {
										data = "";
										boxes = "";
										isBegin = true;

										var list = $('#searchResults1Red tr input[checked="checked"]:lt(100)');
										for ( var i = 0; i < list.length; i++) {
											var boxId = $(list[i]).parent()
													.parent()
													.find('.myBoxText').text();
											if (isBegin) {
												boxes = boxId;
												isBegin = false;
											} else {
												boxes = boxes + ',' + ""
														+ boxId + "";
											}
										}
										data = "json={'ids':[" + boxes
												+ "],'aid':'"
												+ $('#sellArea')[0].value
												+ "','t'='3'}";
										//出库
										if (boxes != "") {
											outWareHouse(data, boxesNoQuote,
													boxes, type);
										}
									} while (list.length>0);

									do {
										data = "";
										boxes = "";
										isBegin = true;

										var list = $('#searchResults1Black tr input[checked="checked"]:lt(100)');
										for ( var i = 0; i < list.length; i++) {
											var boxId = $(list[i]).parent()
													.parent()
													.find('.myBoxText').text();
											if (isBegin) {
												boxes = boxId;
												isBegin = false;
											} else {
												boxes = boxes + ',' + ""
														+ boxId + "";
											}
										}
										data = "json={'ids':[" + boxes
												+ "],'aid':'"
												+ $('#sellArea')[0].value
												+ "','t'='3'}";
										//出库
										if (boxes != "") {
											outWareHouse(data, boxesNoQuote,
													boxes, type);
										}
										
									} while (list.length>0);

									$(this).dialog("close");
								},
								"打印" : function() {

									var el = document
											.getElementById('confirmPrintArea');
									var iframe = document
											.createElement('IFRAME');
									var doc = null;
									iframe
											.setAttribute('style',
													'position:absolute;width:0px;height:0px;left:-500px;top:-500px;');
									document.body.appendChild(iframe);
									doc = iframe.contentWindow.document;

									doc
											.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
													+ '<link rel="stylesheet" type="text/css"	href="../jquery/redmond/jquery-ui-1.9.0.custom.min.css" />'
													+ '<link rel="stylesheet" type="text/css" href="../css/default.css" />'
													+ '<link rel="stylesheet" type="text/css" href="../css/print.css" />'
													+ '<style>@media print{button{display:none} tr{display:block}}</style>');

									doc.write(el.innerHTML);
									doc.close();

									iframe.contentWindow.focus();
									iframe.contentWindow.print();
									if (navigator.userAgent.indexOf("MSIE") > 0) {
										document.body.removeChild(iframe);
									}
									/*
									$("#confirmPrintArea")
											.printElement(
													{
														overrideElementCSS : [
																'../jquery/redmond/jquery-ui-1.9.0.custom.min.css',
																'../css/default.css',
																'../css/print.css' ]
													});
									 */
								}
							}
						});
		$("#confirmoutware").dialog("open");
	}

	//根据箱号搜索出库箱详情 type 2已入库 3已出库 isScaned是否通过机器扫描得到的箱号	
	function onSearchBoxId(boxId, type, isScaned, paramJson) {
		var id;
		var $errMsg;

		if (boxId.length < 3) {
			if (type == '2') {
				$errMsg = $('#errMsg1');
			} else {
				$errMsg = $('#errMsg2');
			}
			$errMsg.text("输入箱号至少为最后3位");
			return;
		}

		if (type == '2') {
			id = "json={'id':'" + boxId + "','t':'2'}";
			$errMsg = $('#errMsg1');
		} else {
			id = "json={'id':'" + boxId + "','t':'3'}";
			$errMsg = $('#errMsg2');
			$('#tabs-2 input[type=checkbox]').removeAttr('checked');
		}
		//请求箱号
		$.ajax({
			url : "../../storage/boxdetail.htm",
			type : "POST",
			cache : false,
			data : id,
			dataType : "json",
			success : function(data, textStatus, jqXHR) {
				if (data != null && data != "") {
					if (data.result == "1") {

						$errMsg.html("");

						var $searchResults = $('#searchResults1Black');
						$searchResults.find('tr').css("font-weight", "normal");
						$('#searchResults1Red').find('tr').css("font-weight",
								"normal");

						if (type == 3) {
							$('#searchResults2').find('tr').remove();
						}

						for ( var i = 0; i < data.boxes.length; i++) {

							//添加到箱号列表
							isSucceed = insertBoxInfo(data.boxes[i], type,
									isScaned, paramJson);
						}

					} else {
						var $eachMyOutBoxIdTrs = $('td[class*="myBoxText"]');
						//删除之前的所有color css		
						$eachMyOutBoxIdTrs.css("color", "");
						//没有您要找的箱子
						$errMsg.html(data.err);
					}
				} else {
					//删除之前的所有color css		
					$eachMyOutBoxIdTrs.css("color", "");
					$errMsg.html("请求网络异常");
				}
			}
		});
	}

	//添加不重复的箱号信息
	//id barcode sitm 入库时间 n产品名称 nc产品代码 type 2为已入库 3为已出库  sotm出库时间 an销售地   isScaned是否通过机器扫描得到的箱号		
	//返回值true 表示成功添加 false 表示重复的行
	function insertBoxInfo(box, type, isScaned, paramJson) {
		//searchResultsIndex为1或2表示当前是在出库还是撤销出库页面
		var $searchResults = $('#searchResults1Black');
		if (type == 3) {//撤销出库界面
			$searchResults = $('#searchResults2');
		}

		var $boxTr = $('#searchResults1Red').find(
				'tr[class*="myOutBoxId' + box.id + '"]');
		if ($boxTr.length != 0) {
			$boxTr.remove();
		}

		//已有该箱号则先删除后添加，并标记为粗体
		$boxTr = $searchResults.find('tr[class*="myOutBoxId' + box.id + '"]');

		if ($boxTr.length != 0) {
			$boxTr.remove();
		}

		var outTypeShow = "";
		var twoColumnsAboutCancel = "";

		if (type == '2') {
			previousBoxId = box.dis;
			outTypeShow = "出库";
			twoColumnsAboutCancel = "<td width='150px' class='myBoxTime'>"
					+ new Date().toLocaleTimeString() + "</td>";
		} else {
			outTypeShow = "撤销出库";
			twoColumnsAboutCancel = "<td width='215px'>" + box.sotm
					+ "</td><td width='160px' align='center'>" + box.an
					+ "</td>";
		}

		$searchResults
				.prepend("<tr class='myOutBoxId"+box.id+"' >"
						+ "<td width='90px'><input type='checkbox' checked/></td>"
						+ "<td width='180px' class='myBoxDis'>"
						+ box.dis
						+ "</td>"
						+ "<td style='display:none' class='myBoxText'>"
						+ box.id
						+ "</td>"
						+ "<td class='myBoxName' align='center'>"
						+ box.n
						+ "<div id='myBoxUids' style='display:none' align='left'/></td>"
						+ "<td class='myProductCode' width='0px' style='display:none'>"
						+ box.nc + "</td>" + "<td width='220px'>" + box.sitm
						+ "</td>" + twoColumnsAboutCancel + "</tr>");

		//当前行
		$boxTr = $searchResults.find('tr[class*="myOutBoxId' + box.id + '"]');

		//新扫到的加上粗体,并且要比对扫描到标签的正确性，否则渲染成红色
		if (type == 2) {
			$boxTr.css('font-weight', 'bold');
		}

		//当前uid层
		var $nowUids = $boxTr.find('#myBoxUids');

		//是否正确的箱信息
		var isCorrect = true;

		//默认去掉checked
		$boxTr.find('td input[type=checkbox]').removeAttr('checked');

		//出库
		if (type == 2) {
			//根据情况填写出库相关uid内容
			if (isScaned) {

				//填写内部uid数据，并接受返回值是否完全匹配箱uid
				isCorrect = onUidValidationAndShow(box, paramJson, $nowUids);

				//如果不正确则被移动到红色区域,不允许被全选,不允许被选中
				if (!isCorrect) {
					//开启和隐藏uid数据,数据在开始的时候就已经有了
					$boxTr.find("[class*='myBoxText']").click(function(event) {
						$(this).parent().find('#myBoxUids').toggle();
					});
					$boxTr.find("[class*='myBoxName']").click(function() {
						$(this).parent().find('#myBoxUids').toggle();
					});
					$boxTr.find("[class*='myBoxTime']").click(function() {
						$(this).parent().find('#myBoxUids').toggle();
					});

					//手势
					$boxTr.find("[class*='myBoxText']").hover(function() {
						$(this).css("cursor", "pointer");
					});
					$boxTr.find("[class*='myBoxName']").hover(function() {
						$(this).css("cursor", "pointer");
					});
					$boxTr.find("[class*='myBoxTime']").hover(function() {
						$(this).css("cursor", "pointer");
					});
					$boxTr.css("color", "#F00");

					//隐藏此列的checkbox
					//$boxTr.find('td input[type=checkbox]').hide();

					$boxTr.css('font-weight', 'bold');

					var $cloneTr = $boxTr.clone(true);
					//移动到红色区域列表
					$('#searchResults1Red').prepend($cloneTr);
					//删除当前行
					$boxTr.remove();
				}
			}
		}//出库逻辑

		$('table tr').removeClass('hover');
		$('table tr:even').addClass('hover');

		return true;
	}

	//出库/撤销操作称 type 2为已入库 3为已出库 isRed为是否错误箱的出库
	function outWareHouse(data, boxid, id, type) {
		$.ajax({
			url : "../../storage/outstorage.htm",
			type : "POST",
			cache : false,
			data : data,
			dataType : "json",
			async : false,
			success : function(data, textStatus, jqXHR) {
				if (data != null && data != "") {
					if (data.result == "1") {

						//判断是出库还是撤销出库
						var $searchResults = $('#searchResults1Black');
						if (type == 3) {
							$searchResults = $('#searchResults2')
						}

						//移除所有已成功出库的箱信息
						if (id != "") {
							var boxArray = id.split(',');
							for ( var i = 0; i < boxArray.length; i++) {
								boxArray[i] = boxArray[i].replace('<br/>', '');
								$searchResults.find(
										'tr[class*="myOutBoxId' + boxArray[i]
												+ '"]').remove();
								if (type == 2) {
									$('#searchResults1Red').find(
											'tr[class*="myOutBoxId'
													+ boxArray[i] + '"]')
											.remove();
								}
							}
						}
						if (type == "2") {
							$('#errMsg1').html("");
						} else {
							$('#errMsg2').html("");
						}

						$('table tr').removeClass('hover');
						$('table tr:even').addClass('hover');

					} else {
						if (type == "2") {
							$('#errMsg1').html(data.err);
						} else {
							$('#errMsg2').html(data.err);
						}
					}
				} else {
					if (type == "2") {
						$('#errMsg1').html("请求网络异常");
					} else {
						$('#errMsg2').html("请求网络异常");
					}
				}
			}
		});
	}

	//显示当前扫到的uid，并显示比对信息，错误的(不属于此箱的uid标记为红色，少扫描到的标记为红色)
	//正确的(匹配此箱的显示为黑色，如果不完全匹配则提供重置该箱功能(如权限不够，需要提升权限))
	//box为当前箱信息,paramJson为Json对象，如
	//模拟"{"boxids":[{"boxid":"551agw12233","uids":[{"uid":"123","seq":"123124125"},{"uid":"AJKSF","seq":"341234"},{"uid":"AJ1sdGKSF","seq":"3ff41234"},{"uid":"AJKSF","seq":"3fzzf41234"},
	//{"uid":"AawegJKSF","seq":"3eeff41234"},{"uid":"AJ23yhKSF","seq":"3eegggff41234"},{"uid":"AJKserhSF","seq":"3eebbb41234"}]}],"uids":["AJKSF","AJ23yhKSF","123"]}"
	//box箱数据	myBoxUidsDiv关联的uid显示区域
	function onUidValidationAndShow(box, paramJson, myBoxUidsDiv) {
		var res = true;
		var uidContent = "<p style='color: #000'>序列号: " + box.dis;
		//实际扫描到的uid
		var scannedUids = paramJson.uids;
		//拷贝的扫描到的uid
		var copyOfscannedUids = scannedUids.slice(0);

		//多出的uid
		var errUids = new Array();
		//匹配的序列号
		var correctedSeqs = new Array();
		//缺少的序列号
		var absentedSeqs = new Array();
		//这里只取了头一箱的数据
		if (paramJson.boxids[0]) {
			//箱匹配的标记
			var boxes = paramJson.boxids[0];
			//实际扫描到的标记
			var uids = paramJson.uids;
			//遍历匹配，填充所有的正确的对应序列号
			for ( var indexBox = 0; indexBox < boxes.uids.length; indexBox++) {
				//缺少的标记+1
				var objUidItem = {};
				objUidItem.seq = boxes.uids[indexBox].seq;
				objUidItem.uid = boxes.uids[indexBox].uid;
				absentedSeqs[absentedSeqs.length] = objUidItem;

				for ( var indexScanedUid = 0; indexScanedUid < uids.length; indexScanedUid++) {
					if (boxes.uids[indexBox].uid == uids[indexScanedUid]) {
						objUidItem = {};
						objUidItem.seq = boxes.uids[indexBox].seq;
						objUidItem.uid = boxes.uids[indexBox].uid;
						correctedSeqs[correctedSeqs.length] = objUidItem;
						//删除最后个标记
						absentedSeqs.pop();
						//标记多出的uid最后删除
						copyOfscannedUids[indexScanedUid] = -1.11;
						break;
					}
				}
			}

			//遍历errUids，消除标记了的元组
			for ( var index = 0; index < copyOfscannedUids.length; index++) {
				if (copyOfscannedUids[index] != -1.11) {
					errUids[errUids.length] = copyOfscannedUids[index];
				}
			}
			//如果不是完全匹配，则要提供一个能够拆箱的功能,需要检查当前权限，如果不符合需要提升权限
			if (correctedSeqs.length != 7) {
				res = false;
				uidContent += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id='destory"+box.id+"'>废除该箱</button>";
			}
			uidContent += "<p/>";
			//遍历三组结果
			//匹配的序列号

			//uidContent += "<div>匹配序列号: ";
			for ( var index = 0; index < correctedSeqs.length - 1; index++) {
				//uidContent += correctedSeqs[index] + ", "
				uidContent += "<p style='color: #000'><span class='ui-icon ui-icon-circle-check' style='float: left; margin-right: .2em;'></span>"
						+ correctedSeqs[index].seq
						+ "["
						+ correctedSeqs[index].uid + "]</p>";
			}
			if ((correctedSeqs.length - 1) >= 0) {
				//uidContent += correctedSeqs[correctedSeqs.length - 1];
				uidContent += "<p style='color: #000'><span class='ui-icon ui-icon-circle-check' style='float: left; margin-right: .2em;'></span>"
						+ correctedSeqs[correctedSeqs.length - 1].seq
						+ "["
						+ correctedSeqs[correctedSeqs.length - 1].uid + "]</p>";
			}
			//uidContent += "</div>";

			//缺少的序列号
			//uidContent += "<div style='color:#F00'>缺少的序列号: ";
			for ( var index = 0; index < absentedSeqs.length - 1; index++) {
				//uidContent += absentedSeqs[index] + ", ";
				uidContent += "<p><span class='ui-icon ui-icon ui-icon-minusthick' style='float: left; margin-right: .2em;'></span>"
						+ absentedSeqs[index].seq
						+ "["
						+ absentedSeqs[index].uid + "]</p>";
			}
			if ((absentedSeqs.length - 1) >= 0) {
				//uidContent += absentedSeqs[absentedSeqs.length - 1];
				uidContent += "<p><span class='ui-icon ui-icon ui-icon-minusthick' style='float: left; margin-right: .2em;'></span>"
						+ absentedSeqs[absentedSeqs.length - 1].seq
						+ "["
						+ absentedSeqs[absentedSeqs.length - 1].uid + "]</p>";
			}
			//uidContent += "</div>";

			//多出的uid
			//uidContent += "<div style='color:#F00'>多扫描到的标签: ";
			for ( var index = 0; index < errUids.length - 1; index++) {
				//uidContent += errUids[index] + ", ";
				uidContent += "<p><span class='ui-icon ui-icon ui-icon-plusthick' style='float: left; margin-right: .2em;'></span>"
						+ "[" + errUids[index] + "]</p>";
			}
			if ((errUids.length - 1) >= 0) {
				//uidContent += errUids[errUids.length - 1];
				uidContent += "<p><span class='ui-icon ui-icon ui-icon-plusthick' style='float: left; margin-right: .2em;'></span>"
						+ "[" + errUids[errUids.length - 1] + "]</p>";
			}
			//uidContent += "</div>";
		}
		//alert(uidContent);
		myBoxUidsDiv.html(uidContent);

		$('#destory' + box.id).click(function() {
			onPromotePowerCancelBox(box);
		})

		return res;
	}

	//弹出废除箱窗口，需要提升权限操作
	function onPromotePowerCancelBox(box) {

		$("#destoryBoxDiv form")[0].reset();
		$("#destoryBoxDiv form #boxid").val(box.id);

		//如果当前是管理员，则隐藏用户名和密码栏
		if (!window.parent.isGranted(0)) {
			$("#usernameandpwd").show();
		} else {
			$("#usernameandpwd").hide();
		}
		$('#errMsg3').html("");
		$("#destoryBoxDiv").dialog("option", "title", "废除箱号: " + box.id);
		$("#destoryBoxDiv").dialog("open");
	}
</script>

<title>Insert title here</title>
</head>
<body>
	<div id="tabs">
		<ul>
			<li id="outBoxTab"><a href="#tabs-1" id="outBoxMode">出库</a></li>
			<li id="cancelBoxTab"><a href="#tabs-2" id="outCancelBoxMode">撤销出库</a>
			</li>
		</ul>

		<div id="tabs-1">
			<div>
				<label for="boxId1">出库箱号:</label> <input type="text" id="boxId1"
					name="boxId1" />
				<button id="searchBox1">添加</button>
				<p />
			</div>
			<div id="filter-search1">
				<font>箱号清单:</font>
				<button id="clearResult1">清除结果集</button>
				<button name="rfidCheck1" id="rfidCheck1">出库扫描</button>
				<p />
			</div>

			<div>
				<div class="ui-widget"
					style="font-size: 78%; color: #f00; display: none;"
					id="somethingerrordiv">
					<div class="ui-state-error ui-corner-all" id="somethingerror"
						style="padding: 5px; overflow-x: hidden; overflow-y: scroll; max-height: 160px;">
					</div>
					<p />
				</div>
				<span id="errMsg1" style="color: #F00"></span>
				<table width="100%" style="margin: 0px">
					<thead>
						<tr>
							<th width="90px" style="text-align: left"><input
								id="selectAll1" type="checkbox" /><label for="selectAll1">全选</label></th>
							<th width="180px">序列号</th>
							<th width="0px" style="display: none">箱号</th>
							<th>产品名称</th>
							<th width="0px" style="display: none">产品代码</th>
							<th width="220px">入库时间</th>
							<th width="150px">出库扫描时间</th>
						</tr>
					</thead>
					<tbody id="searchResults1Red" style="color: #F00;">
					</tbody>
				</table>

				<table width="100%" style="margin: 0px">
					<tbody id="searchResults1Black">
					</tbody>
				</table>
			</div>
			<div style="padding: 5px;" align="right">
				<input type='checkbox' id='selectAll11' /> <label for='selectAll11'>全选</label>
				<button id="allOutBox">批量出库</button>
			</div>
		</div>

		<div id="tabs-2">
			<div>
				<label for="boxId2">撤销箱号:</label> <input type="text" id="boxId2"
					name="boxId2" />
				<button id="searchBox2">搜索</button>
				<p />
			</div>

			<div id="filter-search2">
				<font>箱号清单:</font>
				<button id="clearResult2">清除结果集</button>
				<p />
			</div>

			<div>
				<span id="errMsg2" style="color: #F00"></span>
				<table width="100%" id="boxTable2">
					<thead>
						<tr>
							<th width="90px" style="text-align: left"><input
								id="selectAll2" type="checkbox" /> <label for='selectAll2'>全选</label></th>
							<th width="180px">序列号</th>
							<th width="0px" style="display: none">箱号</th>
							<th>产品名称</th>
							<th width="220px">入库时间</th>
							<th width="215px" id="outTime">上次出库时间</th>
							<th width="160px" id="outArea">上次销售地</th>
						</tr>
					</thead>

					<tbody id="searchResults2" style="font-family: ''">
					</tbody>
				</table>
			</div>
			<div style="padding: 5px;" align="right">
				<input type='checkbox' id='selectAll22' /> <label for='selectAll22'>全选</label>
				<button id="cancelAllOutBox">撤销出库</button>
			</div>
		</div>

		<div id="destoryBoxDiv" title="废除当前箱">
			<p style="color: #F00">注意: 此操作为不可逆的消除该箱所有信息!</p>
			<form>
				<div id="errMsg3" style="color: #F00"></div>
				<div align="center" id="nowboxid"></div>
				<div id="usernameandpwd">
					<label for="pwd">管理员用户名:</label> <input type="text" name="username"
						id="username" class="text ui-widget-content ui-corner-all" /><br />
					<label for="pwd">管理员密码:</label>&nbsp;&nbsp;&nbsp;&nbsp;<input
						type="password" name="password" id="password"
						class="text ui-widget-content ui-corner-all" /><br /> <input
						type="hidden" name="boxid" id="boxid" />
				</div>
			</form>
		</div>

		<div id="confirmoutware" title="出库确认">
			<div style="text-align: right">
				<label for="sellArea">销售地:</label> <select style="min-width: 200px"
					id="sellArea" onchange="onChangeSellArea()">
				</select>
			</div>
			<div id="confirmPrintArea">
				<center>
					<h3>出库确认</h3>
				</center>
				<p />
				<table
					style="border: solid #2575B4; font-weight: normal; font-size: 1em; height: auto">
					<thead>
						<tr style="border: solid #2575B4">
							<th width="33%">产品代码</th>
							<th>产品名称</th>
							<th width="33%">箱数</th>
						</tr>
					</thead>
					<tbody id="statics">
					</tbody>
					<tfoot>
						<tr>
							<td style="text-align: right" colspan="3">销售地:<span
								id="textSellArea"></span>
							</td>
						</tr>
					</tfoot>
				</table>
			</div>
		</div>

	</div>
	<script>
		var params1 = '{"boxids":[{"boxid":"1200212411529","uids":[{"uid":"12366","seq":"123124125"},{"uid":"AJKSF","seq":"341234"},{"uid":"AJ1sdGKSF","seq":"3ff41234"},{"uid":"AJKSF","seq":"3fzzf41234"},'
				+ '{"uid":"AawegJKSF","seq":"3eeff41234"},{"uid":"AJ23yhKSF","seq":"3eegggff41234"},{"uid":"AJKserhSF","seq":"3eebbb41234"},{"uid":"AJKserhSF","seq":"3eebbb41234"}]}],"uids":["AJ1sdGKSF","123","FEEF32"]}';
		var params2 = '{"boxids":[{"boxid":"1200212111526","uids":[{"uid":"1523","seq":"7723124125"},{"uid":"AJKSF","seq":"341234"},{"uid":"AJ1sdGKSF","seq":"3ff41234"},{"uid":"AJKSF","seq":"3fzzf41234"},{"uid":"AawegJKSF","seq":"3eeff41234"},'
				+ '{"uid":"AJ23yhKSF","seq":"3eegggff41234"},{"uid":"AJKserhSF","seq":"3eebbb41234"}]}],"uids":["123","AJKSF","AJ1sdGKSF","AJKSF","AawegJKSF","AJ23yhKSF","AJKserhSF"]}';
		var params3 = '';
		var params4 = "{'boxids':[{'boxid':'1200211711531','uids':[{'uid':'1267C801000108E0','seq':'531'},{'uid':'12BE6601000108E0','seq':'493'},{'uid':'127FF301000108E0','seq':'497'},{'uid':'1289DB01000108E0','seq':'498'},{'uid':'12818401000108E0','seq':'500'},{'uid':'12818301000108E0','seq':'511'},{'uid':'128FD601000108E0','seq':'510'}]}],'uids':['1267C801000108E0']}";

		var box1 = '{"boxids":[{"boxid":"12006131195000006","uids":[{"uid":"0CC2480B92A6D85C","seq":"5000001"},{"uid":"1D4F0B74E2563993","seq":"5000000"},{"uid":"69621100D26E58A5","seq":"5000003"},{"uid":"77FA33F4C5BCA670","seq":"5000004"},{"uid":"B1BEAF73930AE194","seq":"5000002"},{"uid":"FCDCEF28BB293D07","seq":"5000005"}]}],"uids":["1D4F0B74E2563993","0CC2480B92A6D85C","B1BEAF73930AE194","69621100D26E58A5","77FA33F4C5BCA670","FCDCEF28BB293D07","0AE4EEE723F35971"]}';
		var box2 = '{"boxids":[{"boxid":"12006127195000020","uids":[{"uid":"06D0295B9CDDBC68","seq":"5000020"},{"uid":"158390131A526356","seq":"5000015"},{"uid":"74358B983DFCDF93","seq":"5000017"},{"uid":"A2B50D7B070FBA03","seq":"5000018"},{"uid":"A3DDAABE53E0B560","seq":"5000019"},{"uid":"D238C8E09483EFA8","seq":"5000016"},{"uid":"F425BAF4CC9363D4","seq":"5000014"}]}],"uids":["F425BAF4CC9363D4","158390131A526356","D238C8E09483EFA8","74358B983DFCDF93","A2B50D7B070FBA03","A3DDAABE53E0B560","06D0295B9CDDBC68"]}';
		var box3 = '{"boxids":[{"boxid":"12006134195000027","uids":[{"uid":"2A4DF0F3123C84FD","seq":"5000022"},{"uid":"56BF5227B8FDE237","seq":"5000024"},{"uid":"8F97ADC2AD7200F0","seq":"5000025"},{"uid":"B6F7EE3D8225C229","seq":"5000026"},{"uid":"EFE44EA607332686","seq":"5000021"},{"uid":"F0C2FD1616E67875","seq":"5000023"}]}],"uids":["EFE44EA607332686","2A4DF0F3123C84FD","F0C2FD1616E67875","56BF5227B8FDE237","8F97ADC2AD7200F0","B6F7EE3D8225C229","27D4AF0295CC27BC"]}';
		var box4 = '{"boxids":[{"boxid":"12006132195000034","uids":[{"uid":"EF47A7B56C2F45D7","seq":"5000034"},{"uid":"0D9F32B4EAA49E27","seq":"5000032"},{"uid":"10EC11E83DE2BD84","seq":"5000030"},{"uid":"3F06A6168794A58F","seq":"5000028"},{"uid":"747D929033884236","seq":"5000033"},{"uid":"F51E0B4CD8CECD0E","seq":"5000031"},{"uid":"FD2BE0BFBEDA0697","seq":"5000029"}]}],"uids":["3F06A6168794A58F","FD2BE0BFBEDA0697","10EC11E83DE2BD84","F51E0B4CD8CECD0E","0D9F32B4EAA49E27","747D929033884236","EF47A7B56C2F45D7"]}';
		var box5 = '{"boxids":[{"boxid":"12006130195000041","uids":[{"uid":"2E19D479279E2CFD","seq":"5000041"},{"uid":"0825DBD09C167D8F","seq":"5000038"},{"uid":"169C9A63AEA45452","seq":"5000039"},{"uid":"5C8D1F2E17670774","seq":"5000040"},{"uid":"82AD29E998CE2D45","seq":"5000037"},{"uid":"D49B511F01804DCF","seq":"5000035"},{"uid":"F0589DFF85E2F3E2","seq":"5000036"}]}],"uids":["D49B511F01804DCF","F0589DFF85E2F3E2","82AD29E998CE2D45","0825DBD09C167D8F","169C9A63AEA45452","5C8D1F2E17670774","2E19D479279E2CFD"]}';
		var box6 = '{"boxids":[{"boxid":"12006137195000048","uids":[{"uid":"E32E189EE0F56490","seq":"5000048"},{"uid":"5C3C5E5FC9F65AA4","seq":"5000046"},{"uid":"8ACFBCE4DA1141E3","seq":"5000044"},{"uid":"AFB44F5D5507488A","seq":"5000047"},{"uid":"B68427A0BE689199","seq":"5000045"},{"uid":"F0211A729D73DC9B","seq":"5000042"},{"uid":"FB0C371CFF5533A9","seq":"5000043"}]}],"uids":["F0211A729D73DC9B","FB0C371CFF5533A9","8ACFBCE4DA1141E3","B68427A0BE689199","5C3C5E5FC9F65AA4","AFB44F5D5507488A","E32E189EE0F56490"]}';
		var box7 = '{"boxids":[{"boxid":"12006135195000055","uids":[{"uid":"2188A6EC2895E40A","seq":"5000055"},{"uid":"2B80CD95CD739B4D","seq":"5000050"},{"uid":"7ACE9B4C0A07DD0A","seq":"5000052"},{"uid":"8B22309875158AF2","seq":"5000054"},{"uid":"A2DB6659ABD0764C","seq":"5000053"},{"uid":"BA1D519058E8E9DD","seq":"5000049"},{"uid":"C93B35CF7F3C7519","seq":"5000051"}]}],"uids":["BA1D519058E8E9DD","2B80CD95CD739B4D","C93B35CF7F3C7519","7ACE9B4C0A07DD0A","A2DB6659ABD0764C","8B22309875158AF2","2188A6EC2895E40A"]}';
		var box8 = '{"boxids":[{"boxid":"12006133195000062","uids":[{"uid":"1C3E50373C35F13B","seq":"5000062"},{"uid":"118E2A31D371DFC3","seq":"5000058"},{"uid":"8425603975B1258C","seq":"5000056"},{"uid":"9379077FB387B4C3","seq":"5000057"},{"uid":"BDD0E7C1D3843712","seq":"5000061"},{"uid":"E99E09CCEC34CE5E","seq":"5000059"},{"uid":"EDA2ACC388D4313B","seq":"5000060"}]}],"uids":["8425603975B1258C","9379077FB387B4C3","118E2A31D371DFC3","E99E09CCEC34CE5E","EDA2ACC388D4313B","BDD0E7C1D3843712","1C3E50373C35F13B"]}';

		function onTest() {
			onNewBoxId(box1);
			onNewBoxId(box2);
			onNewBoxId(box3);
			onNewBoxId(box4);
			onNewBoxId(box5);
			onNewBoxId(box6);
			onNewBoxId(box7);
			onNewBoxId(box8);
		}
		function onTestonAllErrorUids() {
			var json = '{"uids":["FDF33752000104E0"]}';
			onErrorUids(json);
		}
		function closeApp() {
			window.external.CloseApp();
		}
	</script>
	<!-- <button onClick='onTest()'>测试</button> -->
	<!-- <button onClick = 'doManualUploadLog()'>日志上传</button> -->
	<!-- <button onclick='closeApp()'>关闭</button> -->
	<!-- <button onclick='onTest()'>测试</button> -->
</body>
</html>